var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var Greeter = /** @class */ (function () {
    function Greeter(message) {
        this.greeting = message;
    }
    Greeter.prototype.greet = function () {
        return "Hello, " + this.greeting;
    };
    return Greeter;
}());
var greeter = new Greeter("world");
var Parent = /** @class */ (function () {
    function Parent() {
    }
    Parent.myMethod = function (msg) {
        console.log("static", msg);
    };
    Parent.prototype.myMethod = function (msg) {
        console.log("instance", msg);
    };
    return Parent;
}());
var Child = /** @class */ (function (_super) {
    __extends(Child, _super);
    function Child() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Child.myMethod = function (msg) {
        console.log("child static", msg);
        _super.myMethod.call(this, msg);
    };
    Child.prototype.myMethod = function (msg) {
        console.log("child in", msg);
        _super.prototype.myMethod.call(this, msg);
    };
    return Child;
}(Parent));
// Child.myMethod(1); // static 1
//
// var child = new Child();
// child.myMethod(2); // instance 2
var A = /** @class */ (function () {
    function A(n) {
        this.y = 0;
        console.log(n); //=>100;
        this.x = 1001;
    }
    A.prototype.getX = function () {
        console.log(this.x);
    };
    return A;
}());
var B = /** @class */ (function (_super) {
    __extends(B, _super);
    //=>extends 类似实现原型继承
    function B() {
        var _this = _super.call(this, 100) || this;
        _this.y = 200;
        return _this;
    }
    B.prototype.getY = function () {
        console.log(this.y);
    };
    return B;
}(A));
// let f = new B();
// f.getX();
var Animal = /** @class */ (function () {
    function Animal(theName) {
        this.name = theName;
    }
    Animal.prototype.move = function (distance) {
        if (distance === void 0) { distance = 0; }
        console.log("".concat(this.name, " moved ").concat(distance, "m."));
    };
    return Animal;
}());
var Snake = /** @class */ (function (_super) {
    __extends(Snake, _super);
    function Snake(name) {
        return _super.call(this, name) || this;
    }
    Snake.prototype.move = function (dis) {
        if (dis === void 0) { dis = 3; }
        console.log("Slithering...");
        _super.prototype.move.call(this, dis);
    };
    return Snake;
}(Animal));
var Horse = /** @class */ (function (_super) {
    __extends(Horse, _super);
    function Horse(name) {
        return _super.call(this, name) || this;
    }
    Horse.prototype.move = function (dis) {
        if (dis === void 0) { dis = 45; }
        console.log(dis + '0' + "Galloping..." + dis);
        _super.prototype.move.call(this, dis);
    };
    return Horse;
}(Animal));
var Dog = /** @class */ (function (_super) {
    __extends(Dog, _super);
    function Dog() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Dog.prototype.back = function () {
        console.log("Back,Back");
    };
    return Dog;
}(Animal));
var dog = new Dog("Dog");
// dog.back()
// dog.move(10)
// dog.back()
var sam = new Snake("Sammy the Python");
var tom = new Animal("Tommy the Palomino");
sam.move();
tom.move();
